/*
 * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * <p>
 * https://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package com.liuyjy.es.wrapper;

/**
 * Wrapper 条件构造
 *
 * @author Caratacus
 */
public final class EsWrappers {


    private EsWrappers() {
        // ignore
    }

    /**
     * 获取 EsQueryWrapper&lt;T&gt;
     *
     * @param <T> 实体类泛型
     * @return EsQueryWrapper&lt;T&gt;
     */
    public static <T> EsQueryWrapper<T> query() {
        return new EsQueryWrapper<>();
    }

    /**
     * 获取 EsQueryWrapper&lt;T&gt;
     *
     * @param entity 实体类
     * @param <T>    实体类泛型
     * @return EsQueryWrapper&lt;T&gt;
     */
    public static <T> EsQueryWrapper<T> query(T entity) {
        return new EsQueryWrapper<>(entity);
    }

    /**
     * 获取 EsLambdaQueryWrapper&lt;T&gt;
     *
     * @param <T> 实体类泛型
     * @return EsLambdaQueryWrapper&lt;T&gt;
     */
    public static <T> EsLambdaQueryWrapper<T> lambdaQuery() {
        return new EsLambdaQueryWrapper<>();
    }

    /**
     * 获取 EsLambdaQueryWrapper&lt;T&gt;
     *
     * @param entity 实体类
     * @param <T>    实体类泛型
     * @return EsLambdaQueryWrapper&lt;T&gt;
     */
    public static <T> EsLambdaQueryWrapper<T> lambdaQuery(T entity) {
        return new EsLambdaQueryWrapper<>(entity);
    }

    /**
     * 获取 EsLambdaQueryWrapper&lt;T&gt;
     *
     * @param entityClass 实体类class
     * @param <T>         实体类泛型
     * @return EsLambdaQueryWrapper&lt;T&gt;
     */
    public static <T> EsLambdaQueryWrapper<T> lambdaQuery(Class<T> entityClass) {
        return new EsLambdaQueryWrapper<>(entityClass);
    }

    /**
     * 获取 EsUpdateWrapper&lt;T&gt;
     *
     * @param <T> 实体类泛型
     * @return EsUpdateWrapper&lt;T&gt;
     */
    public static <T> EsUpdateWrapper<T> update() {
        return new EsUpdateWrapper<>();
    }

    /**
     * 获取 EsUpdateWrapper&lt;T&gt;
     *
     * @param entity 实体类
     * @param <T>    实体类泛型
     * @return EsUpdateWrapper&lt;T&gt;
     */
    public static <T> EsUpdateWrapper<T> update(T entity) {
        return new EsUpdateWrapper<>(entity);
    }

    /**
     * 获取 EsLambdaUpdateWrapper&lt;T&gt;
     *
     * @param <T> 实体类泛型
     * @return EsLambdaUpdateWrapper&lt;T&gt;
     */
    public static <T> EsLambdaUpdateWrapper<T> lambdaUpdate() {
        return new EsLambdaUpdateWrapper<>();
    }

    /**
     * 获取 EsLambdaUpdateWrapper&lt;T&gt;
     *
     * @param entity 实体类
     * @param <T>    实体类泛型
     * @return EsLambdaUpdateWrapper&lt;T&gt;
     */
    public static <T> EsLambdaUpdateWrapper<T> lambdaUpdate(T entity) {
        return new EsLambdaUpdateWrapper<>(entity);
    }

    /**
     * 获取 EsLambdaUpdateWrapper&lt;T&gt;
     *
     * @param entityClass 实体类class
     * @param <T>         实体类泛型
     * @return EsLambdaUpdateWrapper&lt;T&gt;
     * @since 3.3.1
     */
    public static <T> EsLambdaUpdateWrapper<T> lambdaUpdate(Class<T> entityClass) {
        return new EsLambdaUpdateWrapper<>(entityClass);
    }

}
